//
//  S1mpl3SpecialCollectionViewCell.m
//  沙哈拉FM
//
//  Created by dllo on 15/11/3.
//  Copyright © 2015年 S1mpl3. All rights reserved.
//

#import "S1mpl3SpecialCollectionViewCell.h"
#import "FitHeader.h"
#import "UIImageView+WebCache.h"

@implementation S1mpl3SpecialCollectionViewCell

-(instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        [self createView];
    }
    return self;
}

- (void)createView{
    _coverPathImageView = [[UIImageView alloc]init];
//    _coverPathImageView.backgroundColor = [UIColor redColor];
    [self.contentView addSubview:_coverPathImageView];
    
    _titleTopLabel = [[BaseLabel alloc]init];
    [_titleTopLabel setFontSize:18];
//    _titleTopLabel.backgroundColor = [UIColor redColor];
    [self.contentView addSubview:_titleTopLabel];
    
    _titleCenterLabel = [[BaseLabel alloc]init];
    [_titleCenterLabel setFontSize:16];
    _titleCenterLabel.textColor = [UIColor lightGrayColor];
//    _titleCenterLabel.backgroundColor = [UIColor redColor];
    [self.contentView addSubview:_titleCenterLabel];
    
    _albumImageView = [[UIImageView alloc] init];
    [self.contentView addSubview:_albumImageView];
    
    _titleBottomLabel = [[BaseLabel alloc]init];
    [_titleBottomLabel setFontSize:14];
    _titleBottomLabel.textColor = [UIColor lightGrayColor];
//    _titleBottomLabel.backgroundColor = [UIColor redColor];
    [self.contentView addSubview:_titleBottomLabel];
}

- (void)layoutSubviews{
    [super layoutSubviews];
    _coverPathImageView.frame = CGRectMake(10 * FITWidth, 0, 100 * FITWidth, 100 * FITHeight);
    _titleTopLabel.frame = CGRectMake(_coverPathImageView.frame.origin.x + _coverPathImageView.frame.size.width + 10 * FITWidth, _coverPathImageView.frame.origin.y, self.contentView.frame.size.width - _coverPathImageView.frame.size.width - 20 * FITWidth, 30 * FITHeight);
    _titleCenterLabel.frame = CGRectMake(_titleTopLabel.frame.origin.x, _titleTopLabel.frame.origin.y + _titleTopLabel.frame.size.height + 5 * FITHeight, _titleTopLabel.frame.size.width, 30 * FITHeight);
    _titleBottomLabel.frame = CGRectMake(_titleCenterLabel.frame.origin.x + 8 * FITWidth, _titleCenterLabel.frame.origin.y + _titleCenterLabel.frame.size.height + 5 * FITHeight, _titleCenterLabel.frame.size.width - 8, _titleCenterLabel.frame.size.height);
    _albumImageView.frame = CGRectMake(_titleTopLabel.frame.origin.x, _titleBottomLabel.frame.origin.y + 10 * FITHeight, 8 * FITWidth, 8 * FITHeight);
    _albumImageView.image = [UIImage imageNamed:@"专辑"];
}

-(void)setSpecial:(S1mpl3Special *)special{
    [_coverPathImageView sd_setImageWithURL:[NSURL URLWithString:special.coverPath] placeholderImage:[UIImage imageNamed:@""]];
    _titleTopLabel.text = special.title;
    _titleCenterLabel.text = special.subtitle;
    _titleBottomLabel.text = special.footnote;
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
